package com.liveinstars.im.corebean;

import lombok.Data;
import lombok.ToString;

import java.util.Objects;

@Data
@ToString
public class TokenServer {

    private String ip;

    private String channelId;

    private int port;

    private String clientId;

    public TokenServer(String clientId, String channelId, String ip, int port) {
        this.clientId = clientId;
        this.channelId = channelId;
        this.ip = ip;
        this.port = port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TokenServer)) return false;
        TokenServer that = (TokenServer) o;
        return getPort() == that.getPort() &&
                Objects.equals(getChannelId(), that.getChannelId()) &&
                Objects.equals(getIp(), that.getIp()) &&
                Objects.equals(getChannelId(), that.getChannelId()) &&
                Objects.equals(getClientId(), that.getClientId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getClientId(), getChannelId(), getIp(), getPort());
    }
}
